package save;

import java.io.File;
import java.io.IOException;

import march.MarchableImage;
import march.Timekeeper;

public class ImageNextEvent extends PerformanceEvent {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6498689318665223167L;
	private transient MarchableImage mi;
	
	private File file;
	private int cols;
	
	public ImageNextEvent(int timestep, File f, int cols) {
		super(timestep);
		
		this.file = f;
		this.cols = cols;
		
	}
	
	@Override
	public void execute() {
		Timekeeper.get().getGridCanvas().setImageOnDeck(mi);

	}

	@Override
	public void unpack() {
		try {
			mi = new MarchableImage(file, cols);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
